import type { IBase, AsyncDataResult } from '../../types'
import { HttpClient } from '../../HttpClient'

export class BaseAPI implements IBase {
  private httpClient: HttpClient

  constructor(httpClient: HttpClient) {
    this.httpClient = httpClient
  }

  public async uuid(): AsyncDataResult<string> {
    return await this.httpClient.request<void, string>('get_uuid')
  }

  public async types(): AsyncDataResult<string> {
    return this.httpClient.request<void, string>('get_column_types')
  }

  public async showPrimaryKey(): AsyncDataResult<string> {
    return this.httpClient.request<void, string>('get_primary_key')
  }

  public async showTables(): AsyncDataResult<string> {
    return this.httpClient.request<void, string[]>('get_tables')
  }
}
